-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Don't start a new node in InternalTestCluster#getClient
#127318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This method would default to starting a new node when the cluster was empty. This is pretty trappy as `getClient()` (or things like `getMaster()` that depend on `getClient()`) don't look at all like something that would start a new node. In any case, the intention of tests is much clearer when they explicitly define a cluster configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't really come up with a great way to split this PR up. If it's too much to review, any suggestions for splitting it up are welcome.
| * An integration test that verifies how different paths/scenarios affect the APM metrics for failure stores. | ||
| */ | ||
| @ESIntegTestCase.ClusterScope(numDataNodes = 0, numClientNodes = 0, scope = ESIntegTestCase.Scope.SUITE) | ||
| @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1, numClientNodes = 0, supportsDedicatedMasters = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests depend on there being exactly one node in the cluster, which I solved like this.
|
|
||
| import java.util.Collection; | ||
|
|
||
| @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests didn't actually need any specific cluster configuration.
| } | ||
|
|
||
| public void testClusterRestartWithLicense() throws Exception { | ||
| wipeAllLicenses(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wiping the licenses before the test starts doesn't make sense if we start with an empty cluster (i.e. no nodes).
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
DaveCTurner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM nice work
The #127318 changed the behaviour of `client()` to not start a node if there is none found in the cluster. Which also changed the `getMasterName()` behaviour to simply fail if there are no nodes instead of starting one. This is why the `getMasterName()` is failing now. There were no nodes started because the test scope is set to manually manage master nodes (`autoManageMasterNodes = false`) without data nodes (`numDataNodes = 0`). The fix is to actually start the master node instead of attempting to get the master node name from an empty cluster and depend on a side effect to actually boostrap a node. Additionally it awaits for the master node to process all cluster state events before proceeding, which should hopefully solve the original cause of failures. Resolves #120964 Resolves #120923
The elastic#127318 changed the behaviour of `client()` to not start a node if there is none found in the cluster. Which also changed the `getMasterName()` behaviour to simply fail if there are no nodes instead of starting one. This is why the `getMasterName()` is failing now. There were no nodes started because the test scope is set to manually manage master nodes (`autoManageMasterNodes = false`) without data nodes (`numDataNodes = 0`). The fix is to actually start the master node instead of attempting to get the master node name from an empty cluster and depend on a side effect to actually boostrap a node. Additionally it awaits for the master node to process all cluster state events before proceeding, which should hopefully solve the original cause of failures. Resolves elastic#120964 Resolves elastic#120923 (cherry picked from commit ee6d64a) # Conflicts: # muted-tests.yml
The elastic#127318 changed the behaviour of `client()` to not start a node if there is none found in the cluster. Which also changed the `getMasterName()` behaviour to simply fail if there are no nodes instead of starting one. This is why the `getMasterName()` is failing now. There were no nodes started because the test scope is set to manually manage master nodes (`autoManageMasterNodes = false`) without data nodes (`numDataNodes = 0`). The fix is to actually start the master node instead of attempting to get the master node name from an empty cluster and depend on a side effect to actually boostrap a node. Additionally it awaits for the master node to process all cluster state events before proceeding, which should hopefully solve the original cause of failures. Resolves elastic#120964 Resolves elastic#120923
This method would default to starting a new node when the cluster was empty. This is pretty trappy as
getClient()(or things likegetMaster()that depend ongetClient()) don't look at all like something that would start a new node.In any case, the intention of tests is much clearer when they explicitly define a cluster configuration.